package com.incar.chuxing.activity;

import android.content.Intent;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.incar.chuxing.R;
import com.incar.chuxing.base.BaseActivity;
import com.incar.chuxing.utils.IntentKey;
import com.incar.chuxing.utils.SharedPreferencesKey;
import com.incar.chuxing.utils.SharedPreferencesUtils;
import com.incar.chuxing.utils.StatusBarUtil;

/**
 * Created by jieyaozu on 2017/5/9.
 * 完成任务了
 */

public class CompleteRedActivity extends BaseActivity implements View.OnClickListener {
    private TextView tvShare;
    private ImageView ivReturn;
    private TextView complete_couponscount, complete_prizeamount;
    private String couponsCount;
    private String prizeAmount;

    @Override
    public int getLayoutId() {
        return R.layout.activity_complete_red;
    }

    @Override
    public void initView() {
        couponsCount = getIntent().getStringExtra("couponsCount");
        prizeAmount = getIntent().getStringExtra("prizeAmount");
        tvShare = (TextView) findViewById(R.id.complete_to_share);
        complete_couponscount = (TextView) findViewById(R.id.complete_couponscount);
        complete_prizeamount = (TextView) findViewById(R.id.complete_prizeamount);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_complete);
        ivReturn = (ImageView) findViewById(R.id.return_complete);
        StatusBarUtil.setTransparentForImageView(this, toolbar);

        complete_couponscount.setText("获得" + couponsCount + "张");
        complete_prizeamount.setText(prizeAmount.replaceAll("(.+)张", ""));
        tvShare.setOnClickListener(this);
        ivReturn.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.return_complete:
                finish();
                break;
            case R.id.complete_to_share:
                Intent intent = new Intent(this, InviteFriendActivity.class);
                intent.putExtra(IntentKey.SHARE_TYPE, 1);
                SharedPreferencesUtils.getInstance(this).putStringValue(SharedPreferencesKey.ORDER_TYPE, "2");
                startActivity(intent);
                finish();
                break;
        }
    }
}
